//
//  FSManagerViewController.m
//  Trade
//
//  Created by 刘沿 on 16/3/31.
//  Copyright © 2016年 刘沿. All rights reserved.
/*
 
 待收  已收  已发  待办  已办 电子公告 最新收文 最新发文 邮件 短信平台 通讯录 
 
 
 */

#import "FSManagerViewController.h"

@interface FSManagerViewController ()<UICollectionViewDataSource,UICollectionViewDelegate>

@end

@implementation FSManagerViewController

static NSString * const reuseIdentifier = @"Cell";

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.navigationItem.title = @"首页";
    
    UICollectionViewFlowLayout *Layout = [[UICollectionViewFlowLayout alloc] init];
    
    Layout.itemSize = CGSizeMake((([UIScreen mainScreen].bounds.size.width - 15) / 4), 100);
    
    Layout.minimumLineSpacing = 10;
    
    Layout.sectionInset = UIEdgeInsetsMake(10, 10, 0, 10);
    
    UICollectionView *collec = [[UICollectionView alloc] initWithFrame:self.view.bounds collectionViewLayout:Layout];
    
    collec.dataSource = self;
    collec.delegate = self;
//    
//    [collec registerClass:[FSManagerCollectionViewCell class] forCellWithReuseIdentifier:reuseIdentifier];

    [collec registerNib:[UINib nibWithNibName:@"FSManagerCollectionViewCell" bundle:nil] forCellWithReuseIdentifier:reuseIdentifier];
    
    collec.backgroundColor = [UIColor whiteColor];
    
    [self.view addSubview:collec];
    
    
    
}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
    
    return 11;
    
}


- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
    
    FSManagerCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:reuseIdentifier forIndexPath:indexPath];
    
    switch (indexPath.item) {
        case 0:
            
            cell.imageName.image = [UIImage imageNamed:@"待办公文-72x72"];
            cell.LabelText.text = @"代收文件";
            
            break;
            
        case 1:
            
            cell.imageName.image = [UIImage imageNamed:@"待办公文-48x48"];
            cell.LabelText.text = @"已收文件";
            
            break;

        case 2:
            cell.imageName.image = [UIImage imageNamed:@"已办事项-48x48"];
            cell.LabelText.text = @"已发文件";
            break;

        case 3:
            cell.imageName.image = [UIImage imageNamed:@"待办事项-48x48"];
            cell.LabelText.text = @"待办文件";
            break;

        case 4:
            cell.imageName.image = [UIImage imageNamed:@"办结事项-48x48"];
            cell.LabelText.text = @"已办文件";
            break;

        case 5:
            cell.imageName.image = [UIImage imageNamed:@"通知通告-48x48"];
            cell.LabelText.text = @"电子公告";
            break;

        case 6:
            cell.imageName.image = [UIImage imageNamed:@"最新收文-72x72"];
            cell.LabelText.text = @"最新收文";
            break;

        case 7:
            cell.imageName.image = [UIImage imageNamed:@"最新发文-72x72"];
            cell.LabelText.text = @"最新发文";
            break;
        case 8:
            cell.imageName.image = [UIImage imageNamed:@"电子邮件-2倍切图"];
            cell.LabelText.text = @"邮件";
            break;

        case 9:
            cell.imageName.image = [UIImage imageNamed:@"短信平台-72x72"];
            cell.LabelText.text = @"短信平台";
            break;
        case 10:
            cell.imageName.image = [UIImage imageNamed:@"通讯录-72x72"];
            cell.LabelText.text = @"通讯录";
            break;
        default:
            break;
    }
    
    
    
    
    return cell;
    
}

#pragma mark-----代理方法
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{

    switch (indexPath.item) {
        case 0:{
            FSupCommingWorkController *upVC = [self.storyboard instantiateViewControllerWithIdentifier:@"upVC"];
            
            [self.navigationController pushViewController:upVC animated:YES];
        }
            break;
            
        default:
            break;
    }
    


}






@end
